<%@ page language="java" pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="ww" uri="webwork" %>
<ww:bean name="'com.css.apps.base.dict.service.DictMan'" id="dictID" />
<ww:bean name="'com.css.apps.base.common.provider.OrgQueryProvider'" id="orgQuery" />
<form class="form-horizontal table-form"  style="width: 800px;height: 500px;" id="roleuser_form" action="dirRoleUser.action"  onsubmit="return $action.query(this)">
	<input type="hidden" name="roleId" id="roleId" value="<ww:property value='roleId'/>">
	<input type="hidden" name="page.orderFlag" id="page.orderFlag" value="<ww:property value='page.orderFlag'/>" class="order-flag"> 
	<input type="hidden" name="page.orderString" id="page.orderString" value="<ww:property value='page.orderString'/>" class="order-string">
	<input type="hidden" name="page.pageSize" class="page-size" value="<ww:property value='page.pageSize'/>">
	<input type="hidden" name="page.totalPages" class="page-count" value="<ww:property value='page.totalPages'/>">
	<input type="hidden" name="page.currentPage" class="page-current" value="<ww:property value='page.currentPage'/>">
	<div class="table-header">
		<div class="table-search">
			<ul>
				<li>姓名/登录名：<input type="text" id="userName" name="userName"  class="input-large" maxlength="20"  placeholder="请输入姓名或登录名" value="<ww:property value='userName'/>"></li>
				<li>所属机构：
						<input class="input-large" type="hidden" name="orgId" id="getroleuser_selId" value="<ww:property value="orgId"/>" />
						<input class="input-large" type="text" name="getroleuser_sel" class="input-medium required" id="getroleuser_sel" value="<ww:property value="#orgQuery.getOrg(orgId).name"/>" onclick="getuser_showMenu();"
							readonly style="cursor:pointer;"/>
						<a id="getroleuser_menuBtn" href="#" onclick="getuser_showMenu(); return false;"></a><br/>
						<div id="getroleuser_menuContent" class="menuContent" style="display:none; position: absolute;padding-left:73px;">
							<ul id="getroleuser_tree" class="ztree" style="margin-top:0; width:153px; height: 260px;background:white;border:#e5e7ee solid 1px;overflow:scroll;"></ul>
						</div>
				</li>
				<li>
				 <ww:button css="btn green" caption="查询" funcode="acl_role/dirRoleUser" type="submit"></ww:button>
				</li>
			</ul>
		</div>
		<div class="table-btn">
			<div class="btn-group">
			  <ww:link funcode="acl_role/addRoleUser" target="cssDialog" title="绑定用户" css="btn" caption="绑定用户" href="getOrgUserTreeRole.action?roleId=%{roleId}"></ww:link>
			</div>
			<div class="btn-group">
			  <ww:link funcode="acl_role/delRoleUser"  title="解绑用户" css="btn" caption="解绑用户" onclick="$action.execBatchThenBack(this,{url:'delRoleUser.action?roleId=%{roleId}'});" href="javascript:;" ></ww:link>
			</div>
		</div>
	</div>
	<table class="table table-bordered">
		<thead>
			<tr>
			    <th width="25px"><input group="ids" type="checkbox" class="cleck-all" name="checkdelall" id="checkdelall"/></th>
			    <%--<th width="80px">操作</th>--%>
				<th width="120px">真实姓名</th>
				<th width="120px">登录名称</th>
				<th  >所属机构</th>
				<th width="40px" >状态</th>
			</tr>
		</thead>
		<tbody>
		    <ww:iterator value="page.results" id="data"> 
			<tr>
				<td class="text-center"><input type="checkbox"  name="ids" id="ids" value="<ww:property value="uuid"/>"/></td>
				<%--<td class="text-center">
			    	<ww:link funcode="acl_role/delRoleUser" caption="取消授权" onclick="$action.exec(this,{url:'delRoleUser.action?ids=%{uuid} & roleId=%{roleId}'});" href="javascript:;"></ww:link>
				</td>--%>
				<td><ww:property value="realName"/></td>
				<td><ww:property value="loginName"/></td>
				<td><ww:property value="orgName"/></td>
				<td class="text-center"><ww:property value="#dictID.getDictType('d_security_Flag',openFlag).name"/></td>
			</tr>
			</ww:iterator>
		</tbody>
	</table>
	<div id="pageid" class="pagination"> <ww:property value="page.pageSplit"/></div>
</form>
<script>
var getuser_setting = {
		check: {
			enable: true,
			chkStyle: "radio",
			radioType: "all"
		},
		data: {
			simpleData: {
				enable: true
			}
		},
		callback: {
			beforeClick : getroleuser_beforeClick,
			onCheck: getroleuser_onCheck
		}
	};

	var getroleuser_zNodes =<ww:property value="tree"/>;
	function getroleuser_beforeClick(treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("getroleuser_tree");
		zTree.checkNode(treeNode, !treeNode.checked, null, true);
		return false;
	}
	function getroleuser_onCheck(e, treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("getroleuser_tree"),
		nodes = zTree.getCheckedNodes(true),
		v = "",
		v1 = "";
		for (var i=0, l=nodes.length; i<l; i++) {
			v += nodes[i].name + ",";
			v1 += nodes[i].id + ",";
		}
		if (v.length > 0 ) v = v.substring(0, v.length-1);
		if (v1.length > 0 ) v1 = v1.substring(0, v1.length-1);
		var cityObj = $("#getroleuser_sel");
		var cityObj1 = $("#getroleuser_selId");
		cityObj.val(v);
		cityObj1.val(v1);
		getuser_hideMenu();
	}
	function getuser_showMenu() {
		$("#getroleuser_menuContent").slideDown("fast");
		$("#roleuser_form").bind("mousedown", getuser_onBodyDown);	
	}
	function getuser_hideMenu() {
		$("#getroleuser_menuContent").fadeOut("fast");
		$("#roleuser_form").unbind("mousedown", getuser_onBodyDown);
	}
	function getuser_onBodyDown(event) {
		if (!(event.target.id == "getroleuser_menuBtn" || event.target.id == "getroleuser_sel" 
				|| event.target.id == "getroleuser_menuContent" || $(event.target).parents("#getroleuser_menuContent").length>0)) {
			getuser_hideMenu();
		}
	}
	using('tree',function(){
	    $.fn.zTree.init($("#getroleuser_tree"), getuser_setting,getroleuser_zNodes);    
	})
	
	
</script>
